<?php
require 'settings.php';
require 'db.php';
?>

<html>
<head>
<title><?php echo $corp_name?> Industry Manager - Add facility</title>

<style type="text/css">
table, th, td
{
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
</style>

</head>
<body>
<h1>Add facility</h1>

<?php

$fac_name = $_POST['fac_name'];
$fac_mat_multiplier = $_POST['fac_mat_multiplier'];
$fac_time_multiplier = $_POST['fac_time_multiplier'];
$fac_install_cost = $_POST['fac_install_cost'];
$fac_hourly_cost = $_POST['fac_hourly_cost'];
$fac_type = $_POST[ 'fac_type'];

//$add_facility = $db_corp->prepare( "INSERT INTO facilities( name, material_multiplier, time_multiplier, installation_cost, per_hour_cost, facility_type) VALUES(?, ?, ?, ?, ?, ?)" );

$add_facility->bind_param( 'sdddds', $fac_name, $fac_mat_multiplier, $fac_time_multiplier, $fac_install_cost, $fac_hourly_cost, $fac_type);

$add_facility->execute();
if( 1 == $add_facility->affected_rows )
{
		echo 'Added facility "'.$fac_name.'".';
}
else
{
		echo "Unable to add facility!";
}


?>
<br />
<a href="add_facility.php">Add another facility</a>
<br />
<a href="view_facilities.php">View facilities</a>
<br />

<a href="index.php">Back to main screen</a>
</body>
</html>